Skip to content

添加VMware DMA设备 - DmaAddDevice

函数简介

添加 VMware DMA 设备,使用默认连接字符串快速添加 VMware 虚拟机作为 DMA 设备。(高级版功能,普通版无法使用)

接口名称

DmaAddDevice

DLL调用

c
int64_t OLA_CALL_TYPE DmaAddDevice(int64_t instance, int32_t vmId);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
vmId整数型VMware虚拟机ID

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
# vmId 为 VMware 虚拟机 ID
deviceId = ola.DmaAddDevice(1)
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);
cpp
var ola = com("OlaPlug.OlaSoft")
// vmId 为 VMware 虚拟机 ID
var deviceId = ola.DmaAddDevice(1)
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
' vmId 为 VMware 虚拟机 ID
deviceId = ola.DmaAddDevice(1)
text
.局部变量 ola, OLAPlug
ola.创建 ()
' vmId 为 VMware 虚拟机 ID
deviceId = ola.DmaAddDevice(1)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
// vmId 为 VMware 虚拟机 ID
var deviceId = ola.DmaAddDevice(1);
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
// vmId 为 VMware 虚拟机 ID
长整数 deviceId = ola.DmaAddDevice(1)
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
// vmId 为 VMware 虚拟机 ID
long deviceId = ola.DmaAddDevice(1);

原生 DLL 调用

cpp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDevice(instance, 1);
csharp
long instance = CreateCOLAPlugInterFace();
long deviceId = DmaAddDevice(instance, 1);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
instance = ola.CreateCOLAPlugInterFace()
deviceId = DmaAddDevice(instance, 1)

返回值

长整数型:成功返回设备ID (>=0),失败返回 -1。